<template>
  <div class="rights">
    <!-- <el-row>
      <el-col :span="24">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item>权限管理</el-breadcrumb-item>
          <el-breadcrumb-item>权限列表</el-breadcrumb-item>
        </el-breadcrumb>
      </el-col>
    </el-row> -->
    <el-table v-loading="isLoading" :data="rightList" border style="width: 100%">
      <el-table-column type="index" width="50"> </el-table-column>
      <el-table-column prop="id" label="权限id" width="180"> </el-table-column>
      <el-table-column prop="authName" label="权限名称" width="180"> </el-table-column>
      <el-table-column prop="path" label="路径"> </el-table-column>
      <el-table-column label="层级">
        <template #default="scope" >
          <el-tag effect="dark" type="success" v-if="scope.row.level==1">
            {{ scope.row.level }}级
          </el-tag>
          <el-tag effect="dark" type='info' v-else-if="scope.row.level==2">
            {{ scope.row.level }}级
          </el-tag>
          <el-tag effect="dark" type='danger' v-else>
            {{ scope.row.level }}级
          </el-tag>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { getRightListApi } from '../../api/rights'

const rightList = ref([])
const isLoading = ref(false)

const getRightList = async () => {
  const res = await getRightListApi({ type: 'list' })
  // console.log(res.data);
  if (res.meta.status == 200) {
    rightList.value = res.data
  }
}

onMounted(() => {
  getRightList()
})
</script>

<style lang="scss" scoped></style>
